<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="f()">点击</button>
</body>
</html>
<script>
    var but=document.querySelector("button")
    function f(){
        var b=5
        but.disabled=true
        but.innerHTML=b
        var a=setInterval(function(){ 
            if(b>0){
                 b--   
                 but.innerHTML=b
            }else{
                clearTimeout(a)
                but.disabled=false
                but.innerHTML='点击'
            }
        },1000)
    }
</script>